<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<title>My Google Data API Application</title>
	<script src="http://www.google.com/jsapi?key=ABQIAAAApSuNmBSTSB_i0nP0aSXuxxRi_j0U6kJrkFvY4-OX2XYmEAa76BTBHk-sILpvQbgl7iKYgP18fhKhbw" type="text/javascript"></script>

	<script type="text/javascript">
	//<![CDATA[

	google.load("gdata", "1");
	google.setOnLoadCallback(main); 

	function main() {
		var scope = 'http://www.google.com/calendar/feeds';
		if(!google.accounts.user.checkLogin(scope)){
			google.accounts.user.login();
		} else {
			/*
			* Retrieve all events
			*/

			// Create the calendar service object
			var calendarService = new google.gdata.calendar.CalendarService('GoogleInc-jsguide-1.0');

			var feedUri = 'http://www.google.com/calendar/feeds/ve1l60am17dk2s6jfaqcqgmvb8%40group.calendar.google.com/public/basic';

			// The callback method that will be called when getEventsFeed() returns feed data
			var callback = function(result) {       

				// Obtain the array of CalendarEventEntry
				var entries = result.feed.entry;    

				// Print the total number of events
				document.getElementById('panel').innerHTML += "Total of " + entries.length + " event(s)" +"<br/><br/>";

				for (var i = 0; i < entries.length; i++ ) {
					var eventEntry = entries[i];
					var eventTitle = eventEntry.getTitle().getText();
					document.getElementById('panel').innerHTML += 'Title: ' + eventTitle  + "<br/>";

					var eventDate = eventEntry.getPublished().getValue().getDate();
					document.getElementById('panel').innerHTML += 'Published date = ' + eventDate  + "<br/><br/>";

				}    
			}

			// Error handler to be invoked when getEventsFeed() produces an error
			var handleError = function(error) {
				document.getElementById('panel').innerHTML += error;
			}

			// Submit the request using the calendar service object
			calendarService.getEventsFeed(feedUri, callback, handleError);

		}
	}	

	//]]>
	</script>

</head>
<body>
	<!-- This image is a crossdomain requirement, communication purpose -->
	<img src="anything.gif" style="position: absolute; top: -1000px;" />
	<div id="panel"/>
</body>
</html>